﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Sockets;
using System.Text;
using System.Threading.Tasks;

namespace Kimd.Communication
{
   public class TcpClientState
    {
       public string EndPoint { get { return TcpClient?.Client.RemoteEndPoint.ToString(); } }
        /// <summary>
        /// 客户端
        /// </summary>
        
        public TcpClient TcpClient;
        /// <summary>
        /// 缓存区
        /// </summary>
        public byte[] Buffer { get; set; }
        /// <summary>
        /// 客户端数据流
        /// </summary>
        public NetworkStream NetworkStream { get { return TcpClient?.GetStream(); } }

        public TcpClientState()
        {

        }

        public TcpClientState(TcpClient tcpClient, byte[] _buffer)
            : this()
        {
            if (tcpClient == null)
                throw new ArgumentNullException("_TcpClient");
            if (_buffer == null)
                throw new ArgumentNullException("_Buffer");
            TcpClient = tcpClient;
            Buffer = _buffer;
        }

    }
}
